package com.itacademy.cinnamonreader.fragments;



import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.Toast;

import com.itacademy.cinnamonreader.R;

public class FeedsFragment extends ListFragment {

	 onFeedsFragmentEventListener feedsFragmentEventListener;
	 Uri feedUri;
	 String data[]={"one","two","three"};
		 int img = R.drawable.rss;

	  
	 @Override
	  public void onAttach(Activity activity) {
	    super.onAttach(activity);
	        try {
	        	feedsFragmentEventListener = (onFeedsFragmentEventListener) activity;
	        } catch (ClassCastException e) {
	            throw new ClassCastException(activity.toString() + " must implement onSomeEventListener");
	        }
	  }
	  
	  @Override
	  public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    
	 
	  }
	  
	  @Override
	  public View onCreateView(LayoutInflater inflater, ViewGroup container,
	      Bundle savedInstanceState) {
	    View view = inflater.inflate(R.layout.feed_list, null);
	    return view;
	  }
	

	  @Override
	  public void onActivityCreated(Bundle savedInstanceState) {
	    super.onActivityCreated(savedInstanceState);
	    
	    MyAdapterHelper myaHelper=new MyAdapterHelper(getActivity(), getListView(),data,img);
	    
	  }
	  
	  public void onListItemClick(ListView l, View v, int position, long id) {
		    super.onListItemClick(l, v, position, id);

		    feedsFragmentEventListener.someEvent(position);
		  }

}
